/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import java.util.List;



/**
 *
 * @author Andrés Felipe
 */

public class Customer implements Serializable {
    private static final long serialVersionUID = 1L;
    
    protected CustomerPK customerPK;
   
    private String name;
   
    private String address;
  
    
    private String email;
    // @Pattern(regexp="^\\(?(\\d{3})\\)?[- ]?(\\d{3})[- ]?(\\d{4})$", message="Invalid phone/fax format, should be as xxx-xxx-xxxx")//if the field contains phone or fax number consider using this annotation to enforce field validation
   
    private String phone;
   
    private List<CustomerRequest> customerRequestList;
   
    private Pyme pyme;
    
    private List<Sales> salesList;

    public Customer() {
    }

    public Customer(CustomerPK customerPK) {
        this.customerPK = customerPK;
    }

    public Customer(CustomerPK customerPK, String name, String address, String email, String phone) {
        this.customerPK = customerPK;
        this.name = name;
        this.address = address;
        this.email = email;
        this.phone = phone;
    }

    public Customer(String identification, int pymeidentification) {
        this.customerPK = new CustomerPK(identification, pymeidentification);
    }

    public CustomerPK getCustomerPK() {
        return customerPK;
    }

    public void setCustomerPK(CustomerPK customerPK) {
        this.customerPK = customerPK;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    
    public List<CustomerRequest> getCustomerRequestList() {
        return customerRequestList;
    }

    public void setCustomerRequestList(List<CustomerRequest> customerRequestList) {
        this.customerRequestList = customerRequestList;
    }

    public Pyme getPyme() {
        return pyme;
    }

    public void setPyme(Pyme pyme) {
        this.pyme = pyme;
    }

 
    public List<Sales> getSalesList() {
        return salesList;
    }

    public void setSalesList(List<Sales> salesList) {
        this.salesList = salesList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (customerPK != null ? customerPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Customer)) {
            return false;
        }
        Customer other = (Customer) object;
        if ((this.customerPK == null && other.customerPK != null) || (this.customerPK != null && !this.customerPK.equals(other.customerPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.Customer[ customerPK=" + customerPK + " ]";
    }
    
}
